home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 15 / 015.d81 / comal tutor #3 (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  18KB  |  453 lines

  1. 8 pokev+33,1:q$=chr$(34):vt$="":dimvt$(25)
  2. 9 fori=.to25:vt$(i)=left$(vt$,i+1):next:vt$=""
  3. 10 r=53265:c=128:v=53248:s=v+1024:li=52016:wi=51200:cl=51203:su=51206:sd=51209
  4. 12 pokes+23,.:pokes+4,128
  5. 15 gosub1000:print"   [215]elcome to this third installment"
  6. 16 print"of [204]oadstar's [195][207][205][193][204][160]0.14 [212]utorial.  [201]n
  7. 17 [153]"the first installment, you entered and
  8. 18 print"ran a short [195][207][205][193][204][160]program to convert
  9. 19 [153]"degrees ascarenheit into degrees lenelsius
  10. 20 print"and in the second you learned how it
  11. 21 [153]"worked.  (NULL)ow, we will learn some new
  12. 22 print"[195][207][205][193][204][160]commands that will let us store"
  13. 23 print"our programs onto our disk drives and"
  14. 24 print"recall them back into our [195]64's "
  15. 25 print"memory.":s%=-1:gosub1200
  16. 26 print"   [215]e want to make sure our program is
  17. 27 [153]"just as we left it.  (NULL)right$(NULL)(NULL)closethe program
  18. 28 print"to be sure it is still there:
  19. 30 [141]1160:[141]1300:x%[178].:y%[178]16:a$[178]"(NULL)right$(NULL)(NULL)":[141]1600
  20. 31 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]31
  21. 32 x%[178]4:y%[178]16:[141]1500:[139]k$[179][177][199](13)[167]32
  22. 33 [153]:[153]"0010 right$(NULL)(NULL)(NULL)(NULL) "q$"str$valchr$(NULL)valval(NULL) asc? "q$": ascatn(NULL)val(NULL)left$valright$(NULL)
  23. 34 print"0020 [195][197][204][211][201][213][211]:=([198][193][210][197][206][200][197][201][212]-32)*(5/9)
  24. 35 [153]"0030 (NULL)(NULL)right$(NULL)(NULL) ascatn(NULL)val(NULL)left$valright$(NULL);"q$"asc ="q$";lenval(NULL)(NULL)right$(NULL)(NULL);"q$"len"q$"":[141]1035
  25. 36 [141]1150:[153]"stop   (NULL)ep, still there!  mid$ust for "
  26. 37 [153]"practice, (NULL)(NULL)(NULL)closethe program and find out"
  27. 38 [153]"how many degrees lenelsius 100 degrees "
  28. 39 [153]"ascarenheit converts into:
  29. 40 gosub1160:x%=.:y%=21:a$="[210][213][206]":gosub1600
  30. 41 ifethena$=mid$(a$,e):e=.:gosub1605:goto41
  31. 42 x%=3:y%=21:gosub1500:ifk$<>chr$(13)then42
  32. 43 print:print"[196][197][199][210][197][197][211] [198]? ";:
  33. 45 x%=11:y%=22:a$="100":gosub1600
  34. 46 ifethena$=mid$(a$,e):e=.:gosub1605:goto46
  35. 47 x%=14:y%=22
  36. 48 gosub1500:ifk$<>chr$(13)then48
  37. 49 print:print"100 [198] = 37.7777778 [195]":gosub1700:print"[197][206][196][160][193][212][160]0030";:gosub1700:gosub1700
  38. 50 gosub1035:gosub1150:print"[144][146]   [217]ep!  [201]t's been getting around
  39. 51 [153]"37.7777778 len down here in (NULL)ousiana.":[141]1205
  40. 55 [153]"   (NULL)ow right$'m sure you have turned your
  41. 56 print"computer off a time or two since we
  42. 57 [153]"'wrote' this program 2 months ago!  right$n
  43. 58 print"real life, our program would be gone
  44. 59 [153]"since turning off the computer erases
  45. 60 print"it's memory!
  46. 61 [153]"   (NULL)e need a way to keep our programs,
  47. 62 print"even when we turn our computer off.
  48. 63 [153]"(NULL)hat, of course, is why you spent a
  49. 64 print"couple of hundred dollars or so on
  50. 65 [153]"that disk drive you've got!":[141]1200
  51. 70 :
  52. 71 :
  53. 72 :
  54. 73 :
  55. 74 :
  56. 75 :
  57. 76 :
  58. 77 :
  59. 78 :
  60. 79 :
  61. 80 [153]"   ascirst off, you need to know a few
  62. 81 print"things.  [193] single floppy disk can hold
  63. 82 [153]"144 'files' or 168,656 'bytes' of "
  64. 83 [153]"data, whichever comes first.  atn 'byte'
  65. 84 print"is equivalent to a character:  i.e. a
  66. 85 [153]"letter, digit, symbol, etc.  atn 'file'
  67. 86 print"is a set of bytes grouped together and
  68. 87 [153]"given a name.  atn file can be a peekatn(NULL)right$len,
  69. 88 print"[195][207][205][193][204][160]or [205]achine [204]anguage program, or
  70. 89 [153]"a graphics picture, a set of sprite
  71. 90 print"shapes, a list of names and phone "
  72. 91 print"numbers, or any other set of data.":gosub1200
  73. 95 print"   [194]efore a disk can be used to hold
  74. 96 [153]"files, it must be 'formatted'.  (NULL)his
  75. 97 print"usually only needs to be done once.
  76. 98 [153]"atnmong other things, the formatting
  77. 99 print"process gives the disk a 'name' and an
  78. 100 [153]"'right$.str$.'.  (NULL)he right$.str$. is two characters,
  79. 101 print"cannot contain a ,[146] or =[146], and must
  80. 102 [153]"be different for each disk you own.
  81. 103 print"[212]he disk name (and file names, too)
  82. 104 [153]"may be up to 16 characters long with
  83. 105 print"no ,[146], =[146], ?[146], or *[146], and may not
  84. 106 [153]"begin with a #wait or a $wait!":[141]1200
  85. 110 [153]"   ascormatting a disk is accomplished
  86. 111 print"by the disk drive itself, not the [195]64!
  87. 112 [153]"right$n other words, you simply (NULL)atn(NULL)(NULL) a "
  88. 113 [153]"command to the disk drive, and it does
  89. 114 print"the work!  [201]n [194][193][211][201][195], this is a tedious
  90. 115 [153]"and involved process.  right$n len(NULL)(NULL)atn(NULL), the
  91. 116 print"[208][193][211][211] statement makes it easy!  [202]ust
  92. 117 [153]"think of (NULL)atn(NULL)(NULL) as a (NULL)(NULL)right$(NULL)(NULL) to the disk
  93. 118 print"drive's 'command channel'.  [193]ny disk
  94. 119 [153]"drive command can be (NULL)atn(NULL)(NULL)ed!
  95. 120 :
  96. 121 gosub1200
  97. 125 print"   [217]our disk drive's manual tells you
  98. 126 [153]"that to format a disk, the 'command
  99. 127 print"channel' must be given a [206][197][215] command.
  100. 128 [153]"(NULL)ike all disk drive 'command channel'
  101. 129 print"commands, this one begins with a "
  102. 130 print"single letter (in this case, [206] for"
  103. 131 print"[206][197][215]), followed by an optional drive"
  104. 132 print"number (either none or 0 unless you"
  105. 133 print"have a dual-drive unit), plus a :[146],"
  106. 134 print"followed by parameters.  [212]he "
  107. 135 print"parameters for the [206][197][215] command are"
  108. 136 print"the [206][193][205][197] and [201][196] for the new disk.":gosub1200
  109. 140 print"   [211]o, a [206][197][215][160]command to give our disk
  110. 141 [153]"the name 'len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1' and an right$str$"
  111. 142 [153]"of 'len1', would be:"
  112. 143 [153]"   '(NULL)0:len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1,len1'.
  113. 144 :
  114. 145 :
  115. 146 :
  116. 147 :
  117. 148 print"   [211]o how do we get this command to
  118. 149 [153]"the disk drive's 'command channel'?
  119. 150 print"[215]ith [195][207][205][193][204]'s [208][193][211][211] statement!":gosub1200
  120. 155 print"   [215]e simply type '[208][193][211][211]', followed by
  121. 156 [153]"the command enclosed within double-
  122. 157 print"quotes.  [206]ow type:"
  123. 158 print"   [208][193][211][211] "q$"[206]0:[195][207][205][193][204][160][208][210][207][199][210][193][205][211]#1,[195]1"q$"
  124. 159 [153]" (str$on't worry..we're (NULL)(NULL)(NULL) going to ":[153]"         (NULL)val(NULL)closeyour disk!)
  125. 160 gosub1160:gosub1300:x%=.:y%=24:a$="[208][193][211][211] "+q$+"[206]0:[195][207][205][193][204] [208][210][207][199][210][193][205][211]#1,[195]1"+q$:gosub1600
  126. 161 ifethena$=mid$(a$,e):e=.:gosub1605:goto161
  127. 162 x%=29:y%=24:gosub1500:ifk$<>chr$(13)then162
  128. 163 gosub1700:gosub1700
  129. 165 gosub1035:gosub1150:gosub1220:print"[144][146][196]one!  [206]ow check status by typing:"
  130. 166 print"   [211][212][193][212][213][211]
  131. 170 [141]1160:x%[178].:y%[178]24:a$[178]"(NULL)(NULL)atn(NULL)(NULL)(NULL)":[141]1600
  132. 171 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]171
  133. 172 x%[178]6:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]172
  134. 173 [141]1700:[153]"00, (NULL)(NULL),00,00";:[141]1700:[141]1700
  135. 175 [141]1035:[141]1150:[153]"stopwait(NULL)ure looks '(NULL)(NULL)' to me!":[141]1205
  136. 180 [153]"   atnfter formatting a disk, we need"
  137. 181 [153]"not do so again.  (NULL)e can save up to"
  138. 182 [153]"144 programs on it!"
  139. 183 :
  140. 184 [153]"   (NULL)o save the current len(NULL)(NULL)atn(NULL) program
  141. 185 print"in memory as a disk file, use [195][207][205][193][204]'s
  142. 186 [153]"'(NULL)atn(NULL)val' command.  (NULL)e simply type '(NULL)atn(NULL)val'
  143. 187 print"followed by our desired file name "
  144. 188 print"enclosed in double-quotes!  [210]emember,"
  145. 189 print"a file name, like a disk name, may be"
  146. 190 print"up to 16 characters long.":gosub1200
  147. 195 print"   [211]ince file names may not contain"
  148. 196 print"a ,[146], =[146], ?[146], or *[146], and may not"
  149. 197 print"begin with a #[146] or $[146], let's call"
  150. 198 print"our program '[195].[195][197][204][